package com.anyext.storage;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

public interface BusinessTemplate {
	// insert or update
	int save(Object business) throws SessionException;

	int save(Collection<?> businesses) throws SessionException;

	int sava(String businessName, Object entity) throws SessionException;

	int sava(String businessName, Collection<?> entities) throws SessionException;

	int insert(Object business) throws SessionException;

	int insert(Collection<?> businesses) throws SessionException;

	int insert(String businessName, Object entity) throws SessionException;

	int insert(String businessName, Collection<?> entities) throws SessionException;

	int update(Object business) throws SessionException;

	int update(Collection<?> businesses) throws SessionException;

	int update(String businessName, Object entity) throws SessionException;

	int update(String businessName, Collection<?> entities) throws SessionException;

	int delete(Object business) throws SessionException;

	int delete(Collection<?> businesses) throws SessionException;

	int delete(String businessName, Object entity) throws SessionException;

	int delete(String businessName, Collection<?> entities) throws SessionException;

	int deleteById(Class<?> businessClass, Serializable id) throws SessionException;

	int deleteById(String businessName, Serializable id) throws SessionException;

	<T> T load(Class<T> businessClass, Serializable id) throws SessionException;

	<T> T get(Class<T> businessClass, Serializable id) throws SessionException;

	int count(Object business) throws SessionException;

	int count(String businessName, Object entity) throws SessionException;

	<T> T queryOne(Object business) throws SessionException;

	<T> T queryOne(String businessName, Object entity) throws SessionException;

	<T> List<T> queryList(Object business) throws SessionException;

	<T> List<T> queryList(String businessName, Object entity) throws SessionException;

	<T> List<T> queryList(Object business, Page page) throws SessionException;

	<T> List<T> queryList(String businessName, Object entity, Page page) throws SessionException;

}
